import { createRouter, createWebHistory } from 'vue-router'

import RegisterView from '@/views/register/index.vue'
import LoginView from '@/views/login/index.vue'
import HomeView from '@/views/Home/index.vue'
import IndexView from '@/views/Home/home.vue'
import CartView from '@/views/Home/cart.vue'
import classView from '@/views/Home/calss.vue'
import MyView from '@/views/Home/my.vue'
import OrderView from '@/views/order/index.vue'
import SerachView from '@/views/serach/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/home' },
    {
      path: '/register',
      component: RegisterView,
    },
    {
      path: '/login',
      component: LoginView,
    },
    {
      path: '/order',
      component: OrderView,
    },
    {
      path: '/serach',
      component: SerachView,
    },
    {
      path: '/home',
      component: HomeView,
      children: [
        {
          path: 'home',
          component: IndexView,
        },
          {
          path: 'cart',
          component: CartView,
        },
          {
          path: 'class',
          component: classView,
        },
          {
          path: 'my',
          component: MyView,
        },
      ]
    },
  ],
})

export default router
